package com.authine.cloudpivot.web.api.controller;
import com.authine.cloudpivot.web.api.controller.base.BaseController;
import com.authine.cloudpivot.web.api.service.MeetingActivityService;
import com.authine.cloudpivot.web.api.vo.MeetingActivities;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Api(description = "和记黄埔相关接口", tags = "获取更新的自办活动事宜")
@RestController
@RequestMapping("/public/meetingactivity")
@Slf4j
@Validated
public class MeetingActivityController extends BaseController{
    @Autowired
    private MeetingActivityService meetingActivityService;


    @ApiOperation(value = "获取更新的自办活动事宜")
    @PostMapping("/getmeetingactivity")
    public List<MeetingActivities> getMeetingActivities(String updatetime) {
        //ResultBean resultBean = new ResultBean();
        //int result = 0;
        List<MeetingActivities> result = new ArrayList<MeetingActivities>();
        result = meetingActivityService.GetUpdatedMeetingActivities(updatetime);
//        if (result == ResultCode.ok) {
//            resultBean.setMsg("操作成功");
//        } else if (result == ResultCode.network_error) {
//            resultBean.setMsg("网络异常，请稍后再试");
//        } else {
//            resultBean.setMsg("操作失败，请检查数据");
//        }
//        resultBean.setResult(result);
        log.info("Get Meeting Activities end，result list：{}", result);
        if (result.size() ==0) {
            return null;
        }else{
            return result;
        }
    }
}
